package com.act;

import android.app.Activity;
import android.os.Bundle;

import com.common.HttpClient;
import com.google.gson.Gson;
import com.mUI.MyToast;
import com.umeng.analytics.MobclickAgent;
import com.xike.util.Manager;

public abstract class BaseAct extends Activity {
	protected static final int MSG_SERVICEDATA_OK = 1;
	protected static final int MSG_SERVICEDATA_ERROR = -1;
	protected MyToast mToast;
	HttpClient client;
	Gson gson;

	protected abstract void initViews();

	protected abstract void updateViews();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		Manager.getInstance(getApplicationContext());
		mToast = new MyToast();
		gson = new Gson();
		client = new HttpClient();
		super.onCreate(savedInstanceState);
	}

	@Override
	protected void onResume() {
		// mToast = new MyToast(this);
		Manager.getInstance(getApplicationContext());
		MobclickAgent.onResume(this);
		super.onResume();
	}

	@Override
	protected void onDestroy() {
		if (client != null) {
			client.cancelAllRequests(true);
		}
		super.onDestroy();
	}

	@Override
	public void onPause() {
		super.onPause();
		MobclickAgent.onPause(this);
	}
}
